package com.example.samplemanagement.dto;

import com.example.samplemanagement.model.Customer;
import com.example.samplemanagement.model.Sample;
import com.example.samplemanagement.model.SampleTracking;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SampleTrackingOverviewDto {
    private Long id; // 可以是样品-客户组合的唯一标识，或者某个聚合的主键
    @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
    private Sample sample; // 包含样品基本信息
    @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
    private Customer customer; // 包含客户基本信息
    private LocalDate latestCommunicationDate; // 最新沟通日期
    private Long communicationCount; // 总沟通次数
    private Long positiveFeedbackCount; // 积极反馈次数
    private Long neutralFeedbackCount; // 中性反馈次数
    private Long negativeFeedbackCount; // 消极反馈次数
    private Long totalFeedbackCount; // 总反馈次数
    private double feedbackRate; // 反馈率
    private SampleTracking.FeedbackType latestFeedbackType; // 最新反馈类型
    private String latestFeedbackContent; // 最新反馈内容
    private boolean isOrderPlaced; // 是否已下单

    // 构造函数
    public SampleTrackingOverviewDto(Long id, Sample sample, Customer customer, Long communicationCount,
                                     double feedbackRate, SampleTracking.FeedbackType latestFeedbackType,
                                     String latestFeedbackContent, // ***新增此参数到构造函数***
                                     LocalDate latestCommunicationDate, boolean isOrderPlaced) {
        this.id = id;
        this.sample = sample;
        this.customer = customer;
        this.communicationCount = communicationCount;
        this.feedbackRate = feedbackRate;
        this.latestFeedbackType = latestFeedbackType;
        this.latestFeedbackContent = latestFeedbackContent; // ***赋值***
        this.latestCommunicationDate = latestCommunicationDate;
        this.isOrderPlaced = isOrderPlaced;
    }
}
